<template>
  <div>
    <div class="section-title">Popular Products</div>
    <div class="section-desc">Have a look at the most liked products by our valued customers</div>
    <div class="product-grid">
      <div v-for="item in products" :key="item.title" class="product-card">
        <img :src="item.img" class="product-img" />
        <div class="product-brand">Haier</div>
        <div class="product-title">{{ item.title }}</div>
        <div class="product-price">Rs. {{ item.price }}</div>
      </div>
    </div>
  </div>
</template>

<script setup>
defineProps({
  products: {
    type: Array,
    required: true
  }
})
</script>

<style scoped lang="less">
.section-title {
  font-size: 0.2rem;
  font-weight: bold;
  margin-top: 0.16rem;
}
.section-desc {
  color: #888;
  font-size: 0.15rem;
  margin-bottom: 0.12rem;
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.12rem;
}
.product-card {
  background: #fff;
  border-radius: 0.08rem;
  padding: 0.08rem;
  text-align: left;
  .product-img {
    width: 100%;
    height: 1.6rem;
    object-fit: cover;
    border-radius: 0.04rem;
  }
  .product-brand {
    display: inline-block;
    background: #222;
    color: #fff;
    font-size: 0.11rem;
    border-radius: 0.03rem;
    padding: 0.01rem 0.06rem;
    margin: 0.06rem 0 0.02rem 0;
  }
  .product-title {
    font-size: 0.13rem;
    font-weight: 500;
    margin-bottom: 0.02rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .product-price {
    color: #222;
    font-size: 0.14rem;
    font-weight: bold;
  }
}
</style> 